package net.shop.action.admin;

import java.util.ArrayList;

import net.shop.biz.vo.admin.ManagerBaseVo;
import net.shop.biz.vo.admin.LanguageVo;
import ths.web.action.ActionSupport;
import ths.web.i18n.I18nManager;
import ths.web.i18n.Language;

public abstract class BaseAdminAction extends ActionSupport {

	protected static ManagerBaseVo managerBaseVo = new ManagerBaseVo();
	
	static {
		ArrayList<Language> languages = I18nManager.getCurrentlySupportLanguages();
		LanguageVo[] vos = new LanguageVo[languages.size()];
		for (int i = 0; i < vos.length; i++) {
			Language l = languages.get(i);
			LanguageVo vo = new LanguageVo();
			vo.setId(l.getLanguageId());
			vo.setName(l.getFullName());
			
			vos[i] = vo;
		}
		
		managerBaseVo.setLanguages(vos);
	}
	
	protected ArrayList<Language> getCurrentlySupportLanguages() {
		return I18nManager.getCurrentlySupportLanguages();
	}
}
